home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
9-Digit Zip Code Directory
/
9-Digit Zip Code Directory (American Business Information) (ABIZIP-12).ISO
/
z4src.zip
/
MYTSTVW.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1995-09-21
|
4KB
|
167 lines
// mytstvw.cpp : implementation of the CMytestView class
//
#include "stdafx.h"
#include "mytest2.h"
#include "mytstdoc.h"
#include "mytstvw.h"
#include "inqone.h"
#include "z4.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
Z4_INQ z4_inq;
/////////////////////////////////////////////////////////////////////////////
// CMytestView
IMPLEMENT_DYNCREATE(CMytestView, CView);
BEGIN_MESSAGE_MAP(CMytestView, CView)
//{{AFX_MSG_MAP(CMytestView)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMytestView construction/destruction
CMytestView::CMytestView()
{
// TODO: add construction code here
}
CMytestView::~CMytestView()
{
}
/////////////////////////////////////////////////////////////////////////////
// CMytestView drawing
void CMytestView::OnDraw(CDC* pDC)
{
//CMytestDoc* pDoc = GetDocument();
//ASSERT_VALID(pDoc);
pDC->TextOut(0,0,"Press left mouse button. . .");
}
/////////////////////////////////////////////////////////////////////////////
// CMytestView diagnostics
#ifdef _DEBUG
void CMytestView::AssertValid() const
{
CView::AssertValid();
}
void CMytestView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CMytestDoc* CMytestView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMytestDoc)));
return (CMytestDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////
/////////// configuration file lookup
void Initialize(void)
{
if (!Z4_INQ::Start())
{
Error("There is a problem accessing the data files.\n"
"Please verify that the program is configured correctly.");
}
return;
}
/////////////////////////////////////////////////////////////////////////////
//// sresults module code
VOID SetResults(void)
{
if (z4_inq.result == Z4_RESULT_FAILURE)
{
Error("Inquiry not possible.");
}
else if (z4_inq.result == Z4_RESULT_ABORT)
{
Error("Inquiry cancelled by user.");
}
else if (z4_inq.result == Z4_RESULT_NOT_FOUND)
{
Error("Not found.");
}
else if (z4_inq.result == Z4_RESULT_INV_ST)
{
Error("Invalid state.");
}
else if (z4_inq.result == Z4_RESULT_INV_CITY)
{
Error("Invalid city.");
}
else if (z4_inq.result == Z4_RESULT_INV_CSZ)
{
Error("Invalid City/State or ZIP.");
}
else
{
AfxMessageBox("Inquiry successful.");
}
return ;
}
/////////////////////////////////////////////////////////////////////////////
// CMytestView message handlers
void CMytestView::OnLButtonDown(UINT nFlags, CPoint point)
{
CString Z4DumpString(const Z4_Z4&);
Initialize();
PCSZ pcszAddr2 = "14917 n st";
PCSZ pcszCity = "omaha";
PCSZ pcszState = "ne";
z4_inq.Set(pcszCity, pcszState, "", "", pcszAddr2);
if (z4_inq.Inquiry() )
{
if (z4_inq.result != Z4_RESULT_EXACT && z4_inq.result != Z4_RESULT_MULTI)
SetResults();
}
if (z4_inq.result == Z4_RESULT_EXACT) {
AfxMessageBox(CString ("Matched! ZIP+4 is ") +
z4_inq.match.rec[0].z4.szZip5 + "-"
+ z4_inq.match.rec[0].z4.szAddonHi);
//+ z4_inq.match.rec[0].z4.szCity);
} else {
if (z4_inq.result == Z4_RESULT_MULTI)
{
AfxMessageBox("Multiple Records Matched");
} else {
AfxMessageBox("Not Matched");
}
}
}